home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / TextServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  13.5 KB  |  400 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        TextServices.h
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1991-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __TEXTSERVICES__
  19. #define __TEXTSERVICES__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __MACTYPES__
  25. #include <MacTypes.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30. #ifndef __MENUS__
  31. #include <Menus.h>
  32. #endif
  33. #ifndef __AEDATAMODEL__
  34. #include <AEDataModel.h>
  35. #endif
  36. #ifndef __AEREGISTRY__
  37. #include <AERegistry.h>
  38. #endif
  39. #ifndef __COMPONENTS__
  40. #include <Components.h>
  41. #endif
  42.  
  43.  
  44.  
  45. #if PRAGMA_ONCE
  46. #pragma once
  47. #endif
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #if PRAGMA_IMPORT
  54. #pragma import on
  55. #endif
  56.  
  57. #if PRAGMA_STRUCT_ALIGN
  58.     #pragma options align=mac68k
  59. #elif PRAGMA_STRUCT_PACKPUSH
  60.     #pragma pack(push, 2)
  61. #elif PRAGMA_STRUCT_PACK
  62.     #pragma pack(2)
  63. #endif
  64.  
  65.  
  66. enum {
  67.     kTextService                = FOUR_CHAR_CODE('tsvc'),        /* component type for the component description */
  68.     kInputMethodService            = FOUR_CHAR_CODE('inpm'),        /* component subtype for the component description */
  69.     kTSMVersion                    = 0x0200,                        /* Version of the Text Services Manager is 2.0  */
  70.     kTextServiceVersion2        = FOUR_CHAR_CODE('tsv2')        /* Interface type for V2 interfaces */
  71. };
  72.  
  73. /* Language and Script constants*/
  74.  
  75. enum {
  76.     kUnknownLanguage            = 0xFFFF,
  77.     kUnknownScript                = 0xFFFF,
  78.     kNeutralScript                = 0x0000FFFF
  79. };
  80.  
  81.  
  82. /* Standard collection tags*/
  83.  
  84.  
  85. enum {
  86.     kInteractiveServicesTag        = FOUR_CHAR_CODE('tmin'),
  87.     kLocaleIDTag                = FOUR_CHAR_CODE('loce'),
  88.     kTextInputObjectTag            = FOUR_CHAR_CODE('tiot'),
  89.     kLocaleObjectRefTag            = FOUR_CHAR_CODE('lobj'),
  90.     kLocaleRefTag                = FOUR_CHAR_CODE('lref'),
  91.     kKeyboardInputMethodContextTag = FOUR_CHAR_CODE('kinp'),
  92.     kKeyboardLocaleObjectRefTag    = FOUR_CHAR_CODE('kilo'),
  93.     kHandwritingInputMethodContextTag = FOUR_CHAR_CODE('hinp'),
  94.     kHandwritingLocaleObjectRefTag = FOUR_CHAR_CODE('hilo'),
  95.     kSpeechInputMethodContextTag = FOUR_CHAR_CODE('sinp'),
  96.     kSpeechLocaleObjectRefTag    = FOUR_CHAR_CODE('silo'),
  97.     kPasswordModeTag            = FOUR_CHAR_CODE('pwdm'),
  98.     kRefconTag                    = FOUR_CHAR_CODE('refc'),
  99.     kUseFloatingWindowTag        = FOUR_CHAR_CODE('uswm'),
  100.     kReadOnlyDocumentTag        = FOUR_CHAR_CODE('isro'),
  101.     kSupportsMultiInlineHolesTag = FOUR_CHAR_CODE('minl'),
  102.     kProtocolVersionTag            = FOUR_CHAR_CODE('nprt'),
  103.     kTSMContextCollectionTag    = FOUR_CHAR_CODE('tsmx')
  104. };
  105.  
  106. /* Standard tags for input method modes*/
  107.  
  108.  
  109. enum {
  110.     kIMRomanInputMode            = FOUR_CHAR_CODE('romn'),
  111.     kIMPasswordInputMode        = FOUR_CHAR_CODE('pasw'),
  112.     kIMXingInputMode            = FOUR_CHAR_CODE('xing'),
  113.     kIMHuaInputMode                = FOUR_CHAR_CODE('huam'),
  114.     kIMPinyinInputMode            = FOUR_CHAR_CODE('piny'),
  115.     kIMQuweiInputMode            = FOUR_CHAR_CODE('quwe'),
  116.     kIMCangjieInputMode            = FOUR_CHAR_CODE('cgji'),
  117.     kIMJianyiInputMode            = FOUR_CHAR_CODE('jnyi'),
  118.     kIMZhuyinInputMode            = FOUR_CHAR_CODE('zhuy'),
  119.     kIMB5CodeInputMode            = FOUR_CHAR_CODE('b5cd'),
  120.     kIMKatakanaInputMode        = FOUR_CHAR_CODE('kata'),
  121.     kIMHiraganaInputMode        = FOUR_CHAR_CODE('hira')
  122. };
  123.  
  124. /* Variant tags for the input modes*/
  125.  
  126.  
  127. enum {
  128.     kIM2ByteInputMode            = FOUR_CHAR_CODE('2byt'),
  129.     kIM1ByteInputMode            = FOUR_CHAR_CODE('1byt'),
  130.     kIMDirectInputMode            = FOUR_CHAR_CODE('dinp')
  131. };
  132.  
  133.  
  134. /* Text Services LocaleObject Attributes*/
  135.  
  136. #define kKeyboardInputMethodTypeName         "\pkeyboardinputmethod"
  137. #define kHandwritingInputMethodTypeName     "\phandwritinginputmethod"
  138. #define kSpeechInputMethodTypeName             "\pspeechinputmethod"
  139. #define kTokenizeServiceTypeName            "\ptokenizetextservice"
  140. #define kInteractiveTextServiceTypeName        "\pinteractivetextservice"
  141. #define kInputMethodModeName                "\pinputmethodmode"
  142. #define kInputMethodModeVariantName            "\pinputmethodvariantmode"
  143. #define kTextServiceModeName                "\ptextservicemode"
  144. #define kTextServiceNeedsInlineAppMode        "\ptextservicesneedsinlineapp"
  145. #define kTextServiceNeedsGetProtocolMode    "\ptextservicesneedsGetProtocol"
  146. #define kTextServiceAnyAppMode                "\ptextservicesanyapp"
  147.  
  148. enum {
  149.     kNeedsInputWindow            = 1,
  150.     kHandlesUpdateRegion        = 2,
  151.     kHandlesGetRegion            = 3,
  152.     kHandlesPos2Offset            = 4,
  153.     kHandlesOffset2Pos            = 5,
  154.     kInPasswordMode                = 6,
  155.     kHandleMultipleHoles        = 7,
  156.     kDocumentIsReadOnly            = 8
  157. };
  158.  
  159.  
  160.  
  161. enum {
  162.                                                                 /* Component Flags in ComponentDescription */
  163.     bTakeActiveEvent            = 15,                            /* bit set if the component takes active event */
  164.     bHandleAERecording            = 16,                            /* bit set if the component takes care of recording Apple Events <new in vers2.0> */
  165.     bScriptMask                    = 0x00007F00,                    /* bit 8 - 14 */
  166.     bLanguageMask                = 0x000000FF,                    /* bit 0 - 7  */
  167.     bScriptLanguageMask            = bScriptMask + bLanguageMask    /* bit 0 - 14  */
  168. };
  169.  
  170.  
  171. enum {
  172.                                                                 /* Low level routines which are dispatched directly to the Component Manager */
  173.     kCMGetScriptLangSupport        = 0x0001,                        /* Component Manager call selector 1 */
  174.     kCMInitiateTextService        = 0x0002,                        /* Component Manager call selector 2 */
  175.     kCMTerminateTextService        = 0x0003,                        /* Component Manager call selector 3 */
  176.     kCMActivateTextService        = 0x0004,                        /* Component Manager call selector 4 */
  177.     kCMDeactivateTextService    = 0x0005,                        /* Component Manager call selector 5 */
  178.     kCMTextServiceEvent            = 0x0006,                        /* Component Manager call selector 6 */
  179.     kCMGetTextServiceMenu        = 0x0007,                        /* Component Manager call selector 7 */
  180.     kCMTextServiceMenuSelect    = 0x0008,                        /* Component Manager call selector 8 */
  181.     kCMFixTextService            = 0x0009,                        /* Component Manager call selector 9 */
  182.     kCMSetTextServiceCursor        = 0x000A,                        /* Component Manager call selector 10 */
  183.     kCMHidePaletteWindows        = 0x000B                        /* Component Manager call selector 11 */
  184. };
  185.  
  186.  
  187.  
  188. /* extract Script/Language code from Component flag ... */
  189. #define        mGetScriptCode(cdRec)        ((ScriptCode)    ((cdRec.componentFlags & bScriptMask) >> 8))
  190. #define        mGetLanguageCode(cdRec)        ((LangCode)        cdRec.componentFlags & bLanguageMask)
  191.  
  192.  
  193. /* New opaque definitions for types*/
  194. typedef struct OpaqueTSMDocumentID*     TSMDocumentID;
  195. typedef OSType                             InterfaceTypeList[1];
  196.  
  197. /* Text Service Info List */
  198.  
  199. struct TextServiceInfo {
  200.     Component                         fComponent;
  201.     Str255                             fItemName;
  202. };
  203. typedef struct TextServiceInfo            TextServiceInfo;
  204. typedef TextServiceInfo *                TextServiceInfoPtr;
  205.  
  206. struct TextServiceList {
  207.     short                             fTextServiceCount;            /* number of entries in the 'fServices' array */
  208.     TextServiceInfo                 fServices[1];                /* Note: array of 'TextServiceInfo' records follows */
  209. };
  210. typedef struct TextServiceList            TextServiceList;
  211. typedef TextServiceList *                TextServiceListPtr;
  212. typedef TextServiceListPtr *            TextServiceListHandle;
  213.  
  214. struct ScriptLanguageRecord {
  215.     ScriptCode                         fScript;
  216.     LangCode                         fLanguage;
  217. };
  218. typedef struct ScriptLanguageRecord        ScriptLanguageRecord;
  219.  
  220. struct ScriptLanguageSupport {
  221.     short                             fScriptLanguageCount;        /* number of entries in the 'fScriptLanguageArray' array */
  222.     ScriptLanguageRecord             fScriptLanguageArray[1];    /* Note: array of 'ScriptLanguageRecord' records follows */
  223. };
  224. typedef struct ScriptLanguageSupport    ScriptLanguageSupport;
  225. typedef ScriptLanguageSupport *            ScriptLanguageSupportPtr;
  226. typedef ScriptLanguageSupportPtr *        ScriptLanguageSupportHandle;
  227. /* High level TSM Doucment routines */
  228. EXTERN_API( OSErr )
  229. NewTSMDocument                    (short                     numOfInterface,
  230.                                  InterfaceTypeList         supportedInterfaceTypes,
  231.                                  TSMDocumentID *        idocID,
  232.                                  long                     refcon)                                TWOWORDINLINE(0x7000, 0xAA54);
  233.  
  234. EXTERN_API( OSErr )
  235. DeleteTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7001, 0xAA54);
  236.  
  237. EXTERN_API( OSErr )
  238. ActivateTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7002, 0xAA54);
  239.  
  240. EXTERN_API( OSErr )
  241. DeactivateTSMDocument            (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7003, 0xAA54);
  242.  
  243. EXTERN_API( Boolean )
  244. SetTSMCursor                    (Point                     mousePos)                            TWOWORDINLINE(0x7006, 0xAA54);
  245.  
  246. EXTERN_API( OSErr )
  247. FixTSMDocument                    (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7007, 0xAA54);
  248.  
  249. /* Utilities */
  250. EXTERN_API( OSErr )
  251. UseInputWindow                    (TSMDocumentID             idocID,
  252.                                  Boolean                 useWindow)                            TWOWORDINLINE(0x7010, 0xAA54);
  253.  
  254. EXTERN_API( Boolean )
  255. TSMEvent                        (EventRecord *            event)                                TWOWORDINLINE(0x7004, 0xAA54);
  256.  
  257. EXTERN_API( Boolean )
  258. TSMMenuSelect                    (long                     menuResult)                            TWOWORDINLINE(0x7005, 0xAA54);
  259.  
  260. EXTERN_API( OSErr )
  261. InitTSMAwareApplication            (void)                                                        TWOWORDINLINE(0x7014, 0xAA54);
  262.  
  263. EXTERN_API( OSErr )
  264. CloseTSMAwareApplication        (void)                                                        TWOWORDINLINE(0x7015, 0xAA54);
  265.  
  266. /* Redundant Utilities */
  267. EXTERN_API( OSErr )
  268. SendAEFromTSMComponent            (const AppleEvent *        theAppleEvent,
  269.                                  AppleEvent *            reply,
  270.                                  AESendMode             sendMode,
  271.                                  AESendPriority         sendPriority,
  272.                                  long                     timeOutInTicks,
  273.                                  AEIdleUPP                 idleProc,
  274.                                  AEFilterUPP             filterProc)                            TWOWORDINLINE(0x700B, 0xAA54);
  275.  
  276. EXTERN_API( OSErr )
  277. NewServiceWindow                (void *                    wStorage,
  278.                                  const Rect *            boundsRect,
  279.                                  ConstStr255Param         title,
  280.                                  Boolean                 visible,
  281.                                  short                     theProc,
  282.                                  WindowPtr                 behind,
  283.                                  Boolean                 goAwayFlag,
  284.                                  ComponentInstance         ts,
  285.                                  WindowPtr *            window)                                TWOWORDINLINE(0x7011, 0xAA54);
  286.  
  287. EXTERN_API( OSErr )
  288. NewCServiceWindow                (void *                    wStorage,
  289.                                  const Rect *            boundsRect,
  290.                                  ConstStr255Param         title,
  291.                                  Boolean                 visible,
  292.                                  short                     theProc,
  293.                                  WindowPtr                 behind,
  294.                                  Boolean                 goAwayFlag,
  295.                                  ComponentInstance         ts,
  296.                                  WindowPtr *            window)                                TWOWORDINLINE(0x701A, 0xAA54);
  297.  
  298. EXTERN_API( OSErr )
  299. CloseServiceWindow                (WindowPtr                 window)                                TWOWORDINLINE(0x7012, 0xAA54);
  300.  
  301. EXTERN_API( OSErr )
  302. GetFrontServiceWindow            (WindowPtr *            window)                                TWOWORDINLINE(0x7013, 0xAA54);
  303.  
  304. EXTERN_API( short )
  305. FindServiceWindow                (Point                     thePoint,
  306.                                  WindowPtr *            theWindow)                            TWOWORDINLINE(0x7017, 0xAA54);
  307.  
  308. EXTERN_API( OSErr )
  309. SetDefaultInputMethod            (Component                 ts,
  310.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700C, 0xAA54);
  311.  
  312. EXTERN_API( OSErr )
  313. GetDefaultInputMethod            (Component *            ts,
  314.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700D, 0xAA54);
  315.  
  316. EXTERN_API( OSErr )
  317. SetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700E, 0xAA54);
  318.  
  319. EXTERN_API( OSErr )
  320. GetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700F, 0xAA54);
  321.  
  322. /* Component Manager Interfaces to Input Methods */
  323. EXTERN_API( ComponentResult )
  324. GetScriptLanguageSupport        (ComponentInstance         ts,
  325.                                  ScriptLanguageSupportHandle * scriptHdl)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  326.  
  327. EXTERN_API( ComponentResult )
  328. InitiateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0002, 0x7000, 0xA82A);
  329.  
  330. EXTERN_API( ComponentResult )
  331. TerminateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  332.  
  333. EXTERN_API( ComponentResult )
  334. ActivateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  335.  
  336. EXTERN_API( ComponentResult )
  337. DeactivateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
  338.  
  339. EXTERN_API( ComponentResult )
  340. TextServiceEvent                (ComponentInstance         ts,
  341.                                  short                     numOfEvents,
  342.                                  EventRecord *            event)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
  343.  
  344. EXTERN_API( ComponentResult )
  345. GetTextServiceMenu                (ComponentInstance         ts,
  346.                                  MenuHandle *            serviceMenu)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  347.  
  348. EXTERN_API( ComponentResult )
  349. TextServiceMenuSelect            (ComponentInstance         ts,
  350.                                  MenuHandle             serviceMenu,
  351.                                  short                     item)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
  352.  
  353. EXTERN_API( ComponentResult )
  354. FixTextService                    (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
  355.  
  356. EXTERN_API( ComponentResult )
  357. SetTextServiceCursor            (ComponentInstance         ts,
  358.                                  Point                     mousePos)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
  359.  
  360. EXTERN_API( ComponentResult )
  361. HidePaletteWindows                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x000B, 0x7000, 0xA82A);
  362.  
  363. EXTERN_API( OSErr )
  364. GetServiceList                    (short                     numOfInterface,
  365.                                  OSType *                supportedInterfaceTypes,
  366.                                  TextServiceListHandle * serviceInfo,
  367.                                  long *                    seedValue)                            TWOWORDINLINE(0x7008, 0xAA54);
  368.  
  369. EXTERN_API( OSErr )
  370. OpenTextService                    (TSMDocumentID             idocID,
  371.                                  Component                 aComponent,
  372.                                  ComponentInstance *    aComponentInstance)                    TWOWORDINLINE(0x7009, 0xAA54);
  373.  
  374. EXTERN_API( OSErr )
  375. CloseTextService                (TSMDocumentID             idocID,
  376.                                  ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700A, 0xAA54);
  377.  
  378.  
  379.  
  380. #if PRAGMA_STRUCT_ALIGN
  381.     #pragma options align=reset
  382. #elif PRAGMA_STRUCT_PACKPUSH
  383.     #pragma pack(pop)
  384. #elif PRAGMA_STRUCT_PACK
  385.     #pragma pack()
  386. #endif
  387.  
  388. #ifdef PRAGMA_IMPORT_OFF
  389. #pragma import off
  390. #elif PRAGMA_IMPORT
  391. #pragma import reset
  392. #endif
  393.  
  394. #ifdef __cplusplus
  395. }
  396. #endif
  397.  
  398. #endif /* __TEXTSERVICES__ */
  399.  
  400.